using UnityEngine;
namespace NL.Advanced
{
    public class ChildCamera : _OwnerOf<Camera>
    {
        public Camera ParentCamer;

        // Start is called before the first frame update

        protected override void Awake()
        {
            base.Awake();

            ParentCamer = transform.parent.GetComponentInParent<Camera>();
        }

        private void LateUpdate()
        {
            if (ParentCamer != null)
            {
                if (ParentCamer.orthographic)
                {
                    _Owner.orthographicSize = ParentCamer.orthographicSize;
                }
                else
                {
                    _Owner.fieldOfView = ParentCamer.fieldOfView;
                }
            }

        }
    }
}

